<?php
@session_start();
$PurviewLevel=3;
$CheckChannelID=1 ;  
$PurviewLevel_Others="";

require("../../inc/common.inc.php");
require_once("../Admin_ChkPurview.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<TITLE>铭讯EOS网站后台管理</TITLE>
<Meta name="Keywords" Content="济南网站建设 济南网站制作 山东网站建设 济南铭讯软件有限公司">
<Meta name="Description" Content="济南网站制作：铭讯软件专业服务优秀企业，致力于网站建、设网站推广、网络营销一体的全访位网络服务商">
<link rel="stylesheet" href="../images/style.css" type="text/css">
</head>
<body> 
<?php
require("../mx_head.php");
?>
<div class="right">
<?php
if ($action=="work"){
    //设置推荐
	if ($jobs=="sethits"){
		foreach( $listhitsdb AS $key=>$value){
			$db->excu("UPDATE mx_vpp_article SET hits='$value' WHERE aid='$key' ");
		}
		jump2("修改成功","$FROMURL",1);
		exit();
	}
	else{
		if(!$listdb&&!$aid){
			$fun->popmassage("请选择一篇文章","","popback");
			exit();
		}
		elseif(is_array($listdb))
		{
			foreach($listdb AS $key=>$value){
				dowork($key,$jobs);
			}
		}elseif($aid){
			dowork($aid,$jobs);
		}
	}
	$url=$fromurl?$fromurl:$FROMURL;
	jump2("操作成功",$url,1);
	exit();
}

function dowork($id,$job){
	global $db,$pre,$timestamp,$userdb,$webdb,$fiddbadmin,$Purview,$fun,$OtherPurview,$Purview,$usersql;
	$rsdb=$db->get_one("SELECT * FROM mx_vpp_article WHERE aid='$id' ");
	$jobwhere="  ";
	if ($Purview!=1){$jobwhere.=" $newsfidsql "; }
	if($job=="delete")
	{
	    if (strpos("****".$OtherPurview,'shenhe')<=0 and $Purview!=1){
		    $fun->popmassage("您没有此项管理权限","","popback");
		    exit();
		}
		$db->excu("delete from mx_vpp_article  WHERE aid='$id' $jobwhere ");
	}
	elseif($job=="move")
	{	
	    if (strpos("****".$OtherPurview,'shenhe')<=0 and $Purview!=1){
		    $fun->popmassage("您没有此项管理权限","","popback");
		    exit();
		}
		global $fid;
		if($fid){
			$rs=$db->get_one("SELECT name FROM mx_vpp_articleclass WHERE fid='$fid'");
			$db->excu("UPDATE mx_vpp_article SET fid='$fid',fname='$rs[name]' WHERE aid='$id'  $jobwhere  ");
		}
	}
	elseif($job=="yz")
	{
	    if (strpos("****".$OtherPurview,'shenhe')<=0 and $Purview!=1){
		    $fun->popmassage("您没有此项管理权限","","popback");
		    exit();
		}
		$db->excu("UPDATE mx_vpp_article SET yz='1',yzer='".$_COOKIE['mxadmin']['username']."',yzid='".$_COOKIE['mxadmin']['userid']."',yzdate='".date("Y-m-d H:i:s")."' WHERE aid='$id'  $jobwhere ");
	}
	elseif($job=="unyz")
	{
	    if (strpos("****".$OtherPurview,'shenhe')<=0 and $Purview!=1){
		    $fun->popmassage("您没有此项管理权限","","popback");
		    exit();
		}
		$db->excu("UPDATE mx_vpp_article SET yz='0',yzer='".$_COOKIE['mxadmin']['username']."',yzid='".$_COOKIE['mxadmin']['userid']."',yzdate='".date("Y-m-d H:i:s")."' WHERE aid='$id' $jobwhere");
	}
	elseif($job=="ishome")
	{
	    if ((strpos("****".$OtherPurview,'shenhe')<=0 and $Purview!=1)){
		    $fun->popmassage("您没有此项管理权限","","popback");
		    exit();
		}
		$db->excu("UPDATE mx_vpp_article SET ishome='1',modiid='".$_COOKIE['mxadmin']['userid']."',modidate='".date("Y-m-d H:i:s")."' WHERE aid='$id' $jobwhere");
	}
	elseif($job=="unishome")
	{
	    if ((strpos("****".$OtherPurview,'shenhe')<=0 and $Purview!=1)){
		    $fun->popmassage("您没有此项管理权限","","popback");
		    exit();
		}
		$db->excu("UPDATE mx_vpp_article SET ishome='0',modiid='".$_COOKIE['mxadmin']['userid']."',modidate='".date("Y-m-d H:i:s")."' WHERE aid='$id' $jobwhere");
	}
	elseif($job=="top")
	{
	    if ((strpos("****".$OtherPurview,'shenhe')<=0 and $Purview!=1)){
		    $fun->popmassage("您没有此项管理权限","","popback");
		    exit();
		}
		$db->excu("UPDATE mx_vpp_article SET istop='1',modiid='".$_COOKIE['mxadmin']['userid']."',modidate='".date("Y-m-d H:i:s")."' WHERE aid='$id' $jobwhere");
	}
	elseif($job=="untop")
	{
	    if ((strpos("****".$OtherPurview,'shenhe')<=0 and $Purview!=1)){
		    $fun->popmassage("您没有此项管理权限","","popback");
		    exit();
		}
		$db->excu("UPDATE mx_vpp_article SET istop='0',modiid='".$_COOKIE['mxadmin']['userid']."',modidate='".date("Y-m-d H:i:s")."' WHERE aid='$id' $jobwhere");
	}
	elseif($job=="sethits")
	{
		print_r("UPDATE mx_vpp_article SET hits='".$listhitsdb[$id]."',modiid='".$_COOKIE['mxadmin']['userid']."',modidate='".date("Y-m-d H:i:s")."' WHERE aid='$id' $jobwhere");
		exit();
		$db->excu("UPDATE mx_vpp_article SET hits='".$listhitsdb[$id]."',modiid='".$_COOKIE['mxadmin']['userid']."',modidate='".date("Y-m-d H:i:s")."' WHERE aid='$id' $jobwhere");
	}
}

require("yx_vpp_menu.php");
?>
<div class="xm2_b">
<div class="height10"></div>
<table width="100%" border="0" cellpadding="8" cellspacing="1" class="table_southidc">
<form name="form1" id="form1" method="post" action="yx_vpp_article.php?action=work<?php echo "&$s"?>">
  <tr>
    <th width="4%" height="27" align="center"></th>
    <th width="6%" align="center">ID</th>
    <th width="" align="center">信息标题</th>
    <th width="10%" align="center">录入时间</th>
    <th width="10%" align="center">点击量</th>
    <th width="10%" align="center">栏目审核</th>
    <th width="20%" align="center">管理操作</th>
  </tr>
<?php
	$s="";
	$str=" and aid>'0' $articlefidsql ";
	if ($ssort!=""){
		$ssort=intval($ssort);
		$fiddb=$db->get_aid($ssort,"mx_vpp_articleclass");
		$str.=" and fid IN ($ssort$fiddb) ";
		$s.="ssort=$ssort&";
	}
	if ($keyword!=""){
		$str.=" and title LIKE '%$keyword%' ";
		$s.="keyword=".urlencode($ssort)."&";
	}
    if ($inputdate!=""){
		$str.=" and (posttime>= '$inputdate 00:00:00' and posttime<= '$inputdate 23:59:59') ";
		$s.="inputdate=$inputdate&";
	}
	if ($yz!=""){
		$yz=intval($yz);
		$str.=" and yz='$yz'";
		$s.="yz=$yz&";
	}
	if ($ishome!=""){
		$ishome=intval($ishome);
		$str.=" and ishome='$ishome'";
		$s.="ishome=$ishome&";
	}
	if ($istop!=""){
		$istop=intval($istop);
		$str.=" and istop='$istop'";
		$s.="istop=$istop&";
	}
	if ($Purview!=1){$str.=" and fid in ($fiddbadmin) ";}

  if(empty($pageindex)){
      $pageindex=1;
  }
  $pagesize=intval($pagesize);
  if ($pagesize<=0){$pagesize=20;}

  $table=" mx_vpp_article ";
  $order=" order by posttime desc, aid desc";
  $column=" * ";
  $biaoid="aid";
  $c=$db->listcount($table,$str);

  $list=$db->list1($pageindex,$pagesize,$table,$column,$str,$order,$biaoid);
	
	
  if (!is_array($list) or $c==0){
  echo "<tr class=\"list\"><td colspan=6><center>暂无信息</center></td></tr>";
  }
  else{
  for($i=0;$i<count($list);$i++){
		$list[$i][ischeck]=$list[$i][yz]?"<A HREF='?action=work&jobs=unyz&aid=".$list[$i][aid]."&bc=$bc&type=$type&sort=$sort' title=取消审核>√</A>":"<A HREF='?action=work&jobs=yz&aid=".$list[$i][aid]."&bc=$bc&type=$type&sort=$sort' style='color:blue;' title=审核通过>X</A>";
		$list[$i][ishome]=$list[$i][ishome]?"<A HREF='?action=work&jobs=unishome&aid=".$list[$i][aid]."&levels=0&bc=$bc&type=$type&sort=$sort' style='color:red;'>取消首显</A>":"<A HREF='?action=work&jobs=ishome&aid=".$list[$i][aid]."&levels=1'>首显</A>";
		$list[$i][istop]=$list[$i][istop]?"<A HREF='?action=work&jobs=untop&aid=".$list[$i][aid]."&levels=0&bc=$bc&type=$type&sort=$sort' style='color:red;'>取消置顶</A>":"<A HREF='?action=work&jobs=top&aid=".$list[$i][aid]."&levels=1'>置顶</A>";
		$list[$i][posttime]=date("Y-m-d",strtotime($list[$i][posttime]));
		?>
  <tr class="list"> 
    <td width="4%" align="center">
      <input type="checkbox" name="listdb[<?php echo $list[$i][aid] ?>]" value="<?php echo $list[$i][aid] ?>" class="input_check"/>    </td>
    <td width="4%" align="center"><?php echo $list[$i][aid]?></td>
    <td width="32%">
			[<a href="yx_vpp_article.php?bc=<?php echo $bc?>&sort=<?php echo $list[$i][fid]?>"><?php echo $list[$i][fname]?></a>] 
			<a href="yx_vpp_article_edit.php?aid=<?php echo $list[$i][aid]?><?php echo "&bc=$bc&type=$type&sort=$sort"?>"><?php echo $list[$i][title]?></a>
<?php
	if ($list[$i]["istop"]==1){echo '<font color="#FFA500">[顶]</font>';}
	if ($list[$i]["ishome"]==1){echo '<font color="#0000FF">[首]</font>';}
?>
    </td>
    <td align="center"><?php echo $list[$i][posttime]?></td>
    <td align="center"><input type="text" name="listhitsdb[<?php echo $list[$i][aid] ?>]" size="5" value="<?php echo $list[$i]['hits']?>"></td>
    <td align="center"><?php echo $list[$i][ischeck]?></td>
    <td align="center">
<a href="yx_vpp_article_edit.php?aid=<?php echo $list[$i][aid]?><?php echo "&bc=$bc&type=$type&sort=$sort"?>">修改</a> 
<?php if ($list[$i][yz]==0 or strpos("****".$OtherPurview,'shenhe')>0 or $Purview==1){?>
<a href="yx_vpp_article.php?action=work&jobs=delete&aid=<?php echo $list[$i][aid]?><?php echo "&bc=$bc&type=$type&sort=$sort"?>">删除</a>	 
<a href="yx_vpp_article_move.php?action=move&listdb[<?php echo $list[$i][aid]?>]=<?php echo $list[$i][aid]?><?php echo "&bc=$bc&type=$type&sort=$sort"?>">移动</a> 
<?php
}
  if($Purview==1 or strpos("****".$OtherPurview,'shenhe')>0){
  echo $list[$i][istop];
  echo "&nbsp;".$list[$i][ishome];
  }
  ?></td>
  </tr>
<?php
	}
	}
?>
<input type="hidden" name="jobs" id="jobs" value="0">
</form>
</table>
<?php if ($c>0){?>
			<div class="height15"></div>
			<div class="do_div">
				<div class="l"><a href="javascript:CheckAll(document.form1,'all')">全选</a>&nbsp;<a href="javascript:CheckAll(document.form1,'')">反选</a></div>
				<div class="l2">
				选择操作：
				<a href="javascript:postdo('yz')">审核</a>
				<a href="javascript:postdo('unyz')">取消审核</a>
				<?php if($Purview==1 or strpos("****".$OtherPurview,'shenhe')>0){?>
				<a href="javascript:postdo('ishome')">首页显示</a>
				<a href="javascript:postdo('unishome')">取消首显</a>
				<a href="javascript:postdo('top')">置顶</a>
				<a href="javascript:postdo('untop')">取消置顶</a>
				<?php }?>
				<a href="javascript:postdo('sethits')">提交点击量</a>
				<a href="javascript:move()">移动</a>
				<a href="javascript:postdo('delete')"/>删除</a>
				</div>
			</div>
			<div class="clear"></div>
			<div class="pagination">
			<?PHP
			echo $db->ThePage_mxsoft($s,$pageindex,$c,$pagesize)
			?>
			</div>
<?php }?>
<div class="clear"></div>
<div class="height10"></div>
<div class="clear"></div>
<script type="text/javascript" src="/mxsoft/js/jquerys-1.5.1.js"></script>
<script language="javascript">
$(document).ready(function(){  
	$(".table_southidc tr").mouseover(function(){   
	$(this).addClass("list2");}).mouseout(function(){   
	$(this).removeClass("list2");}) //移除该行的class   
	$(".table_southidc tr:even").addClass("list1");   
});   
</script> 

<script language="javascript">
function postdo(va){
	document.form1.jobs.value=va
	document.form1.submit();
}
function move(){
	document.form1.action='yx_vpp_article_move.php<?php echo "?bc=$bc&type=$type&sort=$sort"?>';
	document.form1.submit();
}
function doDelete(id){
if(confirm("您确认要删除这些记录吗?")){
		document.form1.action="yx_vpp_article.php?reqCode=delete&channel=mh&bs=mh&at=&sort=&searchbs=&ssort=&kword=&zhuan=z&m=&chkid="+id;
		document.form1.submit();
	
}else{
return;
}
}
</script>
</div>
</div>
<?php require("../mx_foot.php");?>
</body>
</html>
